Data can be collected to supOS through various protocols, it can also be obtained through MQTT subscription, or even directly from supOS database.
Obtaining Data through MQTT Subscription
info
This method is only suitable for third parties who have experience in MQTT protocol.
- Log in to supOS, and then select UNS > Event Flow.
- Click New Event Flow, enter a name and click Save.
- Click the flow you just added, drag an
mqtt in
node, and enter the configurations.- supOS MQTT broker address:
emqx:1883
- Topic: The topic to obtain data from, for example,
factory/workshop/order
.
- supOS MQTT broker address:

- Process the data obtained, or directly use an
mqtt out
node to transmit the data to the third party MQTT.

- Deploy the flow, and data will be pushed to the third party when the topic data changes.
Obtaining Data through API
info
This method is suitable for third parties who does not support MQTT and need event-driven data.
- Log in to supOS, and then select UNS > Event Flow.
- Click New Event Flow, enter a name and click Save.
- Click the flow you just added, drag an
mqtt in
node, and enter the configurations.- supOS MQTT broker address:
emqx:1883
- Topic: The topic to obtain data from, for example,
factory/workshop/order
.
- supOS MQTT broker address:

- Drag a
function
node to the canvas, and write a script to format the data obtained according to third-party receiver API.
// parse payload if it's a string
if (typeof msg.payload === "string") {
msg.payload = JSON.parse(msg.payload);
}
// set headers
msg.headers = {
"Content-Type": "application/json"
};
return msg;
- Use an
http request
node to send the data to the third party through API.

- Deploy the flow, and data will be pushed to the third party when the topic data changes.
Obtaining Data Directly from supOS Database
info
This method is suitable for requests on history data.
- Log in to supOS, and then select UNS > Event Flow.
- Click New Event Flow, enter a name and click Save.
- Click the flow you just added, drag an
inject
node. - Drag a
postgres
node to the canvas, and connect to supOS PostgreSQL database.- Connection
- Host:
postgresql
- Port:
5432
- Database:
postgres
- SSL:
false
- Host:
- Security
- User:
postgres
- Password:
postgres
- User:
- Connection


- Write SQL statements to query data from supOS database.
info
Get the table name from topic Details under Namespace.

SELECT * FROM _order_0baa755c15544f81a302;

- Add an
http request
ormqtt out
node to transmit the queried data to the third party.